home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 4838 / 4838.xpi / chrome / multipletab.jar / content / multipletab / hacks.js < prev    next >
Text File  |  2010-02-03  |  4KB  |  138 lines

  1. MultipleTabService.overrideExtensionsOnPreInit = function MTS_overrideExtensionsOnPreInit() {
  2.  
  3.     // Tab Groups
  4.     if ('TG_Tab_SSTabRestoring_Event' in window) {
  5.         eval('window.TG_Tab_SSTabRestoring_Event = '+
  6.             window.TG_Tab_SSTabRestoring_Event.toSource().replace(
  7.                 '{',
  8.                 <><![CDATA[$&
  9.                     if (MultipleTabService.duplicatingTabs) return;
  10.                 ]]></>
  11.             )
  12.         );
  13.         this.registerDuplicatedTabPostProcess(function(aTab, aIndex) {
  14.             var groups = document.getElementById('TG-GroupList');
  15.             TG_Add_To_Group(aTab, groups.selectedItem);
  16.             gBrowser.moveTabTo(aTab, aIndex);
  17.         });
  18.     }
  19.  
  20.     // Menu Editor
  21.     if ('MenuEdit' in window &&
  22.         'getEditableMenus' in MenuEdit) {
  23.         eval('MenuEdit.getEditableMenus = '+
  24.             MenuEdit.getEditableMenus.toSource().replace(
  25.                 /return menus;/g,
  26.                 'menus["multipletab-selection-menu"] = MultipleTabService.tabSelectionPopup.getAttribute("label"); $&'
  27.             )
  28.         );
  29.     }
  30.  
  31. };
  32.  
  33. MultipleTabService.overrideExtensionsOnInit = function MTS_overrideExtensionsOnInit() {
  34.  
  35.     // Tab Groups
  36.     if ('TG_Group_DnD_Observer' in window) {
  37.         eval('TG_Group_DnD_Observer.onDrop = '+
  38.             TG_Group_DnD_Observer.onDrop.toSource().replace(
  39.                 /(TG_Move_To_Group\([^\)]+\))/,
  40.                 <><![CDATA[
  41.                     var info = {};
  42.                     var tabs = MultipleTabService.getBundledTabsOf(tab, info);
  43.                     if (tabs.length) {
  44.                         tabs.forEach(function(tab) {
  45.                             $1;
  46.                         });
  47.                         return;
  48.                     }
  49.                 ]]></>
  50.             )
  51.         );
  52.         this.registerClearTabValueKey('tg_gname');
  53.         this.registerClearTabValueKey('tg_gid');
  54.         this.registerClearTabValueKey('tg_gselected');
  55.         this.registerClearTabValueKey('tg_tselected');
  56.     }
  57.  
  58.     // Linkwad
  59.     if (document.getElementById('linkwad_toolbar')) {
  60.         if ('sessionObserver' in window)
  61.             eval('sessionObserver.onDrop = '+
  62.                 sessionObserver.onDrop.toSource().replace(
  63.                     '{',
  64.                     <><![CDATA[$&
  65.                         var info = {};
  66.                         var tabs = MultipleTabService.getBundledTabsOf(arguments[2].sourceNode, info);
  67.                         if (tabs.length) {
  68.                             var wadid = arguments[0].target.getAttribute('wad_id');
  69.                             tabs.forEach(function(aTab) {
  70.                                 addURLtoSession(aTab.linkedBrowser.currentURI.spec, wadid);
  71.                             });
  72.                             return;
  73.                         }
  74.                     ]]></>
  75.                 )
  76.             );
  77.     }
  78.  
  79.     // Print All Tabs
  80.     if ('PrintAllTabs' in window) {
  81.         eval('PrintAllTabs.onMenuItemCommand = '+
  82.             PrintAllTabs.onMenuItemCommand.toSource().replace(
  83.                 'this.getTabsToPrint(printAll)',
  84.                 'this.__multipletab__printNodes || $&'
  85.             )
  86.         );
  87.     }
  88.  
  89.     // Tab Mix Plus
  90.     var TMPWarnPref = 'extensions.multipletab.compatibility.TMP.warnForClickActions';
  91.     if (
  92.         'TM_checkClick' in window &&
  93.         this.getPref(TMPWarnPref) &&
  94.         (
  95.             (
  96.                 this.getPref('extensions.tabmix.ctrlClickTab') != 0 &&
  97.                 this.getPref('extensions.multipletab.tabclick.accel.mode') != 0
  98.             ) ||
  99.             (
  100.                 this.getPref('extensions.tabmix.shiftClickTab') != 0 &&
  101.                 this.getPref('extensions.multipletab.tabclick.shift.mode') != 0
  102.             )
  103.         )
  104.         ) {
  105.         let checked = { value : false };
  106.         switch (this.PromptService.confirmEx(
  107.                 null,
  108.                 this.bundle.getString('compatibility_TMP_warning_title'),
  109.                 this.bundle.getString(/mac/i.test(navigator.platform) ? 'compatibility_TMP_warning_text_mac' : 'compatibility_TMP_warning_text' ) + '\n'+
  110.                     this.bundle.getString('compatibility_TMP_warning_text_note'),
  111.                 (this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_0) +
  112.                 (this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_1) +
  113.                 (this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_2),
  114.                 this.bundle.getString('compatibility_TMP_warning_use_multipletab'),
  115.                 this.bundle.getString('compatibility_TMP_warning_use_TMP'),
  116.                 this.bundle.getString('compatibility_TMP_warning_keep'),
  117.                 this.bundle.getString('compatibility_TMP_warning_never'),
  118.                 checked
  119.             ))
  120.         {
  121.             case 0:
  122.                 this.setPref('extensions.tabmix.ctrlClickTab', 0);
  123.                 this.setPref('extensions.tabmix.shiftClickTab', 0);
  124.                 break;
  125.             case 1:
  126.                 this.setPref('extensions.multipletab.tabclick.accel.mode', 0);
  127.                 this.setPref('extensions.multipletab.tabclick.shift.mode', 0);
  128.                 break;
  129.         }
  130.         if (checked.value)
  131.             this.setPref(TMPWarnPref, false);
  132.     }
  133.  
  134. };
  135.  
  136. MultipleTabService.overrideExtensionsOnDelayedInit = function MTS_overrideExtensionsOnDelayedInit() {
  137. };
  138.